]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
extensionSystem: Add 'enabled' property
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 12 Sep 2023 12:11:55 +0000 (14:11 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 3 Jan 2024 20:05:05 +0000 (20:05 +0000)
Unlike `state` which represents the actual state, the new property
reflects the desired state, i.e. whether an extension should be
enabled according to the settings.

The Extension app will soon use it to improve its handling of the
case where the two mismatch (e.g. extension errors).

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7004

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3073>

js/misc/extensionUtils.js
js/ui/extensionSystem.js

index 2b7720abcdd97af1fcd150d2b3d7b4ceda74447c..dc227801f8734337ed2bb3371bf8b64eb034b445 100644 (file)
@@ -30,6 +30,7 @@ export const ExtensionState = {
 const SERIALIZED_PROPERTIES = [
     'type',
     'state',
+    'enabled',
     'path',
     'error',
     'hasPrefs',
index 55b1e11334609a3fd64805436c69bedba76ba747..10e1d92debedb44e9910ddbed5d3559c011763d1 100644 (file)
@@ -429,6 +429,7 @@ export class ExtensionManager extends Signals.EventEmitter {
             path: dir.get_path(),
             error: '',
             hasPrefs: dir.get_child('prefs.js').query_exists(null),
+            enabled: this._enabledExtensions.includes(uuid),
             hasUpdate: false,
             canChange: false,
             sessionModes: meta['session-modes'] ? meta['session-modes'] : ['user'],
@@ -609,6 +610,13 @@ export class ExtensionManager extends Signals.EventEmitter {
     async _onEnabledExtensionsChanged() {
         let newEnabledExtensions = this._getEnabledExtensions();
 
+        for (const extension of this._extensions.values()) {
+            const wasEnabled = extension.enabled;
+            extension.enabled = newEnabledExtensions.includes(extension.uuid);
+            if (wasEnabled !== extension.enabled)
+                this.emit('extension-state-changed', extension);
+        }
+
         // Find and enable all the newly enabled extensions: UUIDs found in the
         // new setting, but not in the old one.
         const extensionsToEnable = newEnabledExtensions